<?php
//april 5, 2006
//static page thing

class Controller extends controllerBase {
	
	public function index($pageId = "")
	{
		if(is_int($pageId))
		{
			//the template was passed the id of a page
			$query = "SELECT `id` FROM `pages` WHERE `id` = '" . $pageId ."' ORDER BY `id` LIMIT 0 , 1";
		}
		else
		{
			//look for a url
			$query = "SELECT `id` FROM `pages` WHERE `url` = '" . $pageId ."' ORDER BY `id` LIMIT 0 , 1";
			
		}
		
		#execute the query
		$query = new Query($query);
		
		if($query->num_rows() > 0)
		{
			$p = $query->fetch_row();
			
			$page = new page($p[0]);
		}
		else
		{
			$this->content = display::error404();
		}
		
		$this->title = $page->title;
		$this->content = $page->content;
	}
	

}